package com.testDemo.hutool;

import cn.hutool.core.net.NetUtil;
import org.junit.jupiter.api.Test;

import java.math.BigInteger;

public class NetutilTest {

    @Test
    public void longToIpv4(){
//        16777472	16778239  China	Fujian	Fuzhou
        String IP = NetUtil.longToIpv4(16777472);
        System.out.println(IP);
        System.out.println(NetUtil.longToIpv4(16778239));

        System.out.println(NetUtil.ipv4ToLong(IP));


    }
    @Test
    public void bigIntegerToIPv6(){
//        16777472	16778239  China	Fujian	Fuzhou
        String IP = NetUtil.bigIntegerToIPv6(BigInteger.valueOf(16777472));
        System.out.println(IP);
        System.out.println(NetUtil.bigIntegerToIPv6(BigInteger.valueOf(16778239)));

        System.out.println(NetUtil.ipv6ToBigInteger(IP));


    }


}
